package cn.jiyun.function.service.impl;

import cn.jiyun.function.mapper.SysRegionMapper;
import cn.jiyun.function.service.SysRegionService;
import cn.jiyun.pojo.SysRegion;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysRegionServiceImpl implements SysRegionService {
    @Autowired
    SysRegionMapper sysRegionMapper;

    @Override
    public PageInfo<SysRegion> findPage(Integer pageNum, Integer pageSize, SysRegion sysRegion) {
            Page<SysRegion> sysRegions = PageHelper.startPage(pageNum, pageSize);
            List<SysRegion> sysRegionMapperPage = sysRegionMapper.findPage(sysRegions,sysRegion);
            return new PageInfo<>(sysRegionMapperPage);
        }

    @Override
    public SysRegion toUpdate(Integer regionId) {
        return sysRegionMapper.toUpdate(regionId);
    }

    @Override
    public void updateById(SysRegion sysRegion) {
        sysRegionMapper.updateById(sysRegion);
    }

}
